function count(str) {
    let frequencyObj = {};

    for (let i = 0; i < str.length; i++) {
        let char = str[i];

        if (char.trim() === '') {
            continue;
        }

        if (frequencyObj[char]) {
            frequencyObj[char]++;
        } else {
            frequencyObj[char] = 1;
        }
    }

    return frequencyObj;
}
  
console.log(count('hello world'))
